﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public static class StringExtensions
    {

        public static string ToBase64(this string str)
        {
            string b64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(str));
            return b64;
        }
        public static string FromBase64(this string b64)
        {
            string str = Encoding.UTF8.GetString(Convert.FromBase64String(b64));
            return str;
        }

        public static bool IsEmpty(this string str)
        { 
            return string.IsNullOrWhiteSpace(str);
        }


        public static bool BiggerThan(this string s1, string s2, bool ignoreCase = false)
        {
            return string.Compare(s1, s2, ignoreCase) > 0;
        }

        public static bool LittlerThan(this string s1, string s2, bool ignoreCase = false)
        {
            return string.Compare(s1, s2, ignoreCase) < 0;
        }


    }
}
